import { createStore } from "vuex";
import admin from "@/store/admin";
import tagpage from "@/store/tagpage";
import userinfo from "@/store/userinfo";

export default createStore({
  modules: { admin, tagpage, userinfo },
});
// 重置store
export function resetStore() {
  let arrObj = { admin, tagpage, userinfo };
  let modules = JSON.parse(sessionStorage.getItem("modules"));
  for (const key in arrObj) {
    arrObj[key] = modules[key];
  }
}
// 设置初始值
export function setStore() {
  if (!sessionStorage.getItem("modules")) {
    let initModules = { admin, tagpage, userinfo };
    sessionStorage.setItem("modules", JSON.stringify(initModules));
  }
}
